\input{../slidesComun}

\title[9. Linear algebra applications in geometry]{Chapter 9. Linear algebra applications in geometry}  
\COSS

% ==============================================
\begin{frame}\frametitle{References} 

\begin{figure}
	\includegraphics[height=5cm]{figFarin.jpg}
	\includegraphics[height=5cm]{figJuanDeBurgos.jpg}
\end{figure}
G. Farin, D. Hansford. Practical Linear Algebra: a geometry toolbox. A.K. Peters (2005). \\
J. de Burgos. Álgebra lineal y geometría cartesiana. McGraw Hill 2ª Ed. (2000)

\end{frame}

% ==============================================
\setnextsection{9}
\section{Linear algebra applications in geometry} 
\subsection{Local and global coordinates} 
\Outline

\begin{frame}\frametitle{Local and global coordinates}
\begin{exerciseblock}{Reference}
	Farin and Hansford, Chapter 1
\end{exerciseblock}

\begin{block}{Local and global coordinates}
	In real applications we may need to distinguish between local and global coordinates.
	\begin{center}
		\includegraphics[scale=0.4]{figLocalGlobalCoordinates.png}
	\end{center}
	And we need some way of transforming one into the other. This is nothing more than a change of basis.
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Local and global coordinates}
\begin{exampleblock}{Shift and scale}
	\begin{columns}
		\begin{column}{7cm}
		  In Vector Graphics it is common to design objects in a local coordinate system ($\mathbf{d}$) and, then,
			place, rotate and scale the object in the global coordinate system  ($\mathbf{e}$). We need some transformation to go from one space
			to the other.\\
			\vspace{0.5cm}
			For the first component, $d_1$, we note that we go from a local interval $[0,1]$ to a global interval $[min_1,max_1]$. We may easily perform the transformation as
			\begin{center}
				$\frac{d_1-0}{1-0}=\frac{e_1-min_1}{max_1-min_1} \Rightarrow $\\
				$e_1=min_1+(max_1-min_1)d_1$
			\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=6.5cm]{figLocalGlobalCoordinates2.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{exampleblock}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Local and global coordinates}
\begin{exampleblock}{Shift and scale}
	The more general transformation maps the local interval $[min_{d1},max_{d1}]$ to the global interval $[min_{e1},max_{e1}]$. This is achieved with
	transformation
	\begin{center}
		$e_1=min_{e1}+\frac{max_{e1}-min_{e1}}{max_{d1}-min_{d1}}d_1$
	\end{center}
	
	The same kind of transformation is applied to the second component ($d_2 \rightarrow e_2$). Putting everything in matrix notation we have
	\begin{center}
		$\mathbf{e}=\begin{pmatrix}min_{e1}\\min_{e2}\end{pmatrix}+
		   \begin{pmatrix}\frac{max_{e1}-min_{e1}}{max_{d1}-min_{d1}} & 0 \\ 0 & \frac{max_{e2}-min_{e2}}{max_{d2}-min_{d2}} \end{pmatrix} \mathbf{d}$
	\end{center}
	This transformation is of the form
	\begin{center}
		$\mathbf{e}=T(\mathbf{d})=\mathbf{e}_{min}+A\mathbf{d}$
	\end{center}
	that is not a linear transformation because of the shift (e.g., show that $T(\mathbf{d}_1+\mathbf{d}_2)\neq T(\mathbf{d}_1)+T(\mathbf{d}_2)$).
\end{exampleblock}

\end{frame}

% ==============================================
\subsection{Points and vectors} 
\Outline

\begin{frame}\frametitle{Points and vectors}
\begin{exerciseblock}{Reference}
	Farin and Hansford, Chapter 2
\end{exerciseblock}

\begin{block}{Points and vectors}
	\begin{columns}
		\begin{column}{7cm}
		  We also need to distinguish between points and vectors. Both are represented as a list of coordinates. Informally,
			a point indicates a location in space, while a vector indicates a direction (orientation+sense) in space. In this example, we have two
			points, $\mathbf{p}$ and $\mathbf{q}$, and a vector $\mathbf{v}$ that goes from $\mathbf{p}$ to $\mathbf{q}$. We may talk about the length
			of a vector, but not of a point.\\
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figPointVector.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Points and vectors}
\begin{block}{Points and vectors}
	\begin{columns}
		\begin{column}{7cm}
		  In this example we have multiple copies of the same vector (since they all have the same direction and magnitude). In Physics, forces are vectors that
			are applied to objects that are located at points. In this figure we would see the same force applied to different objects.
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figManyVecs.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Points and vectors}
\begin{block}{Points and vectors}
	\begin{columns}
		\begin{column}{7cm}
			More formally, points belong to an Euclidean space while vectors belong to a vector space.
			\begin{center}
				$\mathbf{p},\mathbf{q}\in\mathbb{E}^2$ \\
				$\mathbf{v}\in\mathbb{R}^2$
			\end{center}
			Although we may represent both spaces in the same figure and we may define operations using both kinds of spaces.
			The goal of distinguishing between points and vectors is to distinguish between operations that depend on the coordinate
			system and operations that do not.
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=6.5cm]{figSpaces.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Operations on points and vectors}
\begin{block}{Coordinate independent operations}
	$\begin{array}{rcl}
		 -:&\mathbb{E}^2\times\mathbb{E}^2 \rightarrow \mathbb{R}^2 & \quad \mathbf{v}=\mathbf{q}-\mathbf{p} \\
		 +:&\mathbb{E}^2\times\mathbb{R}^2 \rightarrow \mathbb{E}^2 & \quad \mathbf{p}=\mathbf{q}+\mathbf{v} \\
		 +:&\mathbb{R}^2\times\mathbb{R}^2 \rightarrow \mathbb{R}^2 & \quad \mathbf{v}=\mathbf{u}+\mathbf{w} \\
		 \cdot:&\mathbb{R}\times\mathbb{R}^2 \rightarrow \mathbb{R}^2 & \quad \mathbf{v}=r\mathbf{u} \\
	\end{array}$
\end{block}

\begin{block}{Coordinate dependent operations}
	$\begin{array}{rcl}
		 +:&\mathbb{E}^2\times\mathbb{E}^2 \rightarrow \mathbb{E}^2 & \quad \mathbf{t}=\mathbf{p}+\mathbf{q} \\
		 \cdot:&\mathbb{R}\times\mathbb{E}^2 \rightarrow \mathbb{E}^2 & \quad \mathbf{q}=r\mathbf{p} \\
	\end{array}$
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Vector fields}
\begin{block}{Vector fields}
  Any function that assigns a vector to a point
	$\begin{array}{rcl}
		 f:&\mathbb{E}^2 \rightarrow \mathbb{R}^2 & \mathbf{v}=f(\mathbf{p}) \\
	\end{array}$
\end{block}

\begin{exampleblock}{Example}
	\begin{columns}
		\begin{column}{5cm}
			\begin{center}
				$f(x,y)=(x,y)$\\
				\includegraphics[width=4.5cm]{figVectorField1.png}
			\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				$f(x,y)=(-y,x)$\\
				\includegraphics[width=4.5cm]{figVectorField2.png}
			\end{center}
		\end{column}
	\end{columns}
\end{exampleblock}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Combinations of points}
\begin{block}{Barycentric combinations}
  A weighted sum of points where the weights add up to 1 is called a barycentric combination
\end{block}

\begin{exampleblock}{Example}
	\begin{columns}
		\begin{column}{5cm}
			\begin{center}
				$\mathbf{r}=(1-t)\mathbf{p}+t\mathbf{q}=\mathbf{p}+t(\mathbf{q}-\mathbf{p})$\\
				\includegraphics[width=4.5cm]{figBarycombo13.eps}
			\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				$\mathbf{s}=t_1\mathbf{r}+t_2\mathbf{p}+t_3\mathbf{q}$\\
				\includegraphics[width=4.5cm]{figBarycombo.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{exampleblock}
\end{frame}

% ==============================================
\subsection{Lines in 2D} 
\Outline

\begin{frame}\frametitle{Lines in 2D}
\begin{exerciseblock}{Reference}
	Farin and Hansford, Chapter 3
\end{exerciseblock}

\begin{block}{Parametric equation of a line}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Given two points}:\\
				      $\mathbf{l}(t)=\mathbf{p}+t(\mathbf{q}-\mathbf{p}) \quad t\in\mathbb{R}$
				\item \underline{Given point and vector}:\\
				      $\mathbf{l}(t)=\mathbf{p}+t\mathbf{v} \quad t\in\mathbb{R}$
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figParametricLine.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{Implicit equation of a line}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Given a point and the normal direction}:\\
				      $\mathbf{a}\cdot(\mathbf{x}-\mathbf{p})=0$\\
							\vspace{0.5cm}
							In 2D:\\
							\vspace{0.5cm}
							\begin{center}
								$(a_1,a_2)\cdot(x_1-p_1,x_2-p_2)=0 \Rightarrow $\\
								$ax_1+bx_2+c=0$\\
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figImplicitLine.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{Explicit equation of a line}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Given a point and slope}:\\
							In 2D:\\
							\vspace{0.5cm}
							\begin{center}
								$x_2=p_2+m(x_1-p_1)$\\
								$x_2=mx_1+b$\\
								$x_2=(\tan\Theta) x_1+b$
							\end{center}
							But it is not a good representation for vertical lines.
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figExplicitLine.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{Distance of a point to a line}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Implicit line}:\\
				      Line: $\mathbf{a}\cdot (\mathbf{x}-\mathbf{p})=0$\\
							Point: $\mathbf{r}$\\
							\vspace{0.5cm}
							Let $\mathbf{w}=\mathbf{r}-\mathbf{p}$ and calculate:
							\begin{center}
								$\mathbf{a}\cdot \mathbf{w}=\|\mathbf{a}\|\|\mathbf{w}\|\cos(\theta)$
							\end{center}
							Analyzing the figure we note that $\cos(\theta)=\frac{d}{\|w\|}$. Then
							\begin{center}
								$\mathbf{a}\cdot \mathbf{w}=\|\mathbf{a}\|d \Rightarrow d=\frac{\mathbf{a}\cdot \mathbf{w}}{\|\mathbf{a}\|}$
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=6cm]{figDistpt2line.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{Distance of a point to a line}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Parametric line}:\\
				      Line: $\mathbf{l}(t)=\mathbf{p}+t\mathbf{v}$\\
							Point: $\mathbf{r}$\\
							\vspace{0.5cm}
							Let $\mathbf{w}=\mathbf{r}-\mathbf{p}$ and calculate:
							\begin{center}
								$\mathbf{v}\cdot \mathbf{w}=\|\mathbf{v}\|\|\mathbf{w}\|\cos(\alpha)$
							\end{center}
							Analyzing the figure we note that $\sin(\alpha)=\frac{d}{\|w\|}=\sqrt{1-\cos^2(\alpha)}$. Then
							\begin{center}
								$d=\|\mathbf{w}\|\sqrt{1-\left(\frac{\mathbf{v}\cdot \mathbf{w}}{\|\mathbf{v}\|\|\mathbf{w}\|}\right)^2}$
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=6cm]{figDistpt2line.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{The foot of a point}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Parametric line}:\\
				      Line: $\mathbf{l}(t)=\mathbf{p}+t\mathbf{v}$\\
							Point: $\mathbf{r}$\\
							\vspace{0.5cm}
							Let $\mathbf{w}=\mathbf{r}-\mathbf{p}$. The closest point within the line to $\mathbf{r}$ is
							\begin{center}
								$\mathbf{q}=\mathbf{p}+\mathrm{Proj}_{\mathbf{v}}\{\mathbf{w}\}=
								   \mathbf{p}+\frac{\mathbf{v}\cdot\mathbf{w}}{\|\mathbf{v}\|^2}\mathbf{v}$
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figClosestpt2line.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{The intersection of two lines}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Parametric lines}:\\
				      Line 1: $\mathbf{l}_1(t)=\mathbf{p}+t\mathbf{v}$\\
				      Line 2: $\mathbf{l}_2(s)=\mathbf{q}+s\mathbf{w}$\\
							\vspace{0.5cm}
							We need to solve the equation system
							\begin{center}
								$\mathbf{l}_1(t)=\mathbf{l}_2(s)$ \\
								$\mathbf{p}+t\mathbf{v}=\mathbf{q}+s\mathbf{w}$\\
								$\begin{pmatrix}\mathbf{v} & -\mathbf{w}\end{pmatrix}\begin{pmatrix}t \\ s\end{pmatrix}=\mathbf{q}-\mathbf{p}$
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figPara_para_int.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines in 2D}
\begin{block}{The intersection of two lines}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Implicit lines}:\\
				      Line 1: $\mathbf{a}\cdot(\mathbf{x}-\mathbf{p})=0$\\
				      Line 1: $\overline{\mathbf{a}}\cdot(\mathbf{x}-\mathbf{q})=0$\\
							\vspace{0.5cm}
							We need to find $\mathbf{x}$ satisfying both equations at the same time
							\begin{center}
								$\mathbf{a}^T\mathbf{x}-\mathbf{a}^T\mathbf{p}=0$ \\
								$\overline{\mathbf{a}}^T\mathbf{x}-\overline{\mathbf{a}}^T\mathbf{q}=0$ \\
								$\begin{pmatrix}\mathbf{a}^T \\ \overline{\mathbf{a}}^T\end{pmatrix}\mathbf{x}=\begin{pmatrix}\mathbf{a}^T\mathbf{p} \\ \overline{\mathbf{a}}^T\mathbf{q}\end{pmatrix}$
							\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figImp_imp.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\subsection{Affine maps in 2D} 
\Outline

\begin{frame}\frametitle{Affine maps in 2D}
\begin{exerciseblock}{Reference}
	Farin and Hansford, Chapter 6
\end{exerciseblock}

\begin{block}{Affine change of coordinates}
	\begin{columns}
		\begin{column}{7cm}
		    We transform the point $\mathbf{x}$ into point $\mathbf{x}'$. Note that the matrix multiplication is performed on vectors, not on points
				\begin{center}
					$\mathbf{v}=\mathbf{x}-\mathbf{o}$\\
					$\mathbf{v}'=A\mathbf{v}$\\
					$\mathbf{x}'=\mathbf{p}+\mathbf{v}'$\\
				\end{center}
				In total
				\begin{center}
					$\mathbf{x}'=\mathbf{p}+A(\mathbf{x}-\mathbf{o})$\\
				\end{center}
				We may go back by 
				\begin{center}
					$\mathbf{x}=\mathbf{o}+A^{-1}(\mathbf{x}'-\mathbf{p})$\\
				\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5.5cm]{figSkewbox.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Affine maps in 2D}
\begin{block}{Translations and rotations}
	\begin{columns}
		\begin{column}{7cm}
				\begin{itemize}
					\item \underline{Translation}: $\mathbf{x}'=\mathbf{p}+(\mathbf{x}-\mathbf{o})$\\
					\item \underline{Rotation}: $\mathbf{x}'-\mathbf{r}=R_{\alpha}(\mathbf{x}-\mathbf{r})$\\
				\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figRotpoint.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Affine maps in 2D}
\begin{block}{Mirrors and compositions}
	\begin{columns}
		\begin{column}{7cm}
				\begin{itemize}
					\item \underline{Mirror}: \\
					  \begin{center}
							$\mathbf{p}=\frac{1}{2}(\mathbf{x}+\mathbf{x}')$\\
							$\mathbf{x}'=2\mathbf{p}-\mathbf{x}$\\
						\end{center}
					\item \underline{Compositions}: \\
					  \begin{center}
							\begin{tabular}{c}
								$\mathbf{x}'=\mathbf{o}'+A(\mathbf{x}-\mathbf{o})$\\
								$\mathbf{x}''=\mathbf{o}''+A'(\mathbf{x}'-\mathbf{o}')$\\
								\hline
								$\mathbf{x}''=\mathbf{o}''+A'A(\mathbf{x}-\mathbf{o})$\\
							\end{tabular}
						\end{center}
				\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figReflectex.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\subsection{Conic sections in 2D} 
\Outline

\begin{frame}\frametitle{Conic sections}
\begin{exerciseblock}{Reference}
	Juan de Buegos (2000), Capítulo 11
\end{exerciseblock}

\begin{block}{Conic sections}
	The circle, the ellipse, the parabola, and the hyperbola are all curves stemming from a section of a cone.
	\begin{center}
		\includegraphics[scale=0.22]{figConicSections.png}
	\end{center}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Conic sections}
\begin{block}{Conic sections}
	They are all second order curves
	\begin{center}
		$\underbrace{ax_1^2+bx_2^2+cx_1x_2}_\text{2nd order}+ \underbrace{dx_1+ex_2}_\text{1st order}+\underbrace{f}_\text{0th order}=0$
	\end{center}
	By renaming the coefficients, we may rewrite it as
	\begin{center}
		$a_{11}x_1^2+a_{22}x_2^2+2a_{12}x_1x_2+2b_1x_1+2b_2x_2+c=0$\\
		$\begin{pmatrix}x_1 & x_2\end{pmatrix} \begin{pmatrix}a_{11} & a_{12} \\ a_{12} & a_{22}\end{pmatrix} \begin{pmatrix}x_1 \\ x_2\end{pmatrix}+
		 2\begin{pmatrix}b_1 & b_2\end{pmatrix}\begin{pmatrix}x_1 \\ x_2\end{pmatrix}+c=0$\\
		$\mathbf{x}^TA\mathbf{x}+2B\mathbf{x}+c=0$
	\end{center}
	Compare this to the more widely known equation of the parabola $y=ax^2+bx+c$. Finally, we can write it in a very compact form
	\begin{center}
		$\tilde{\mathbf{x}}^TM\tilde{\mathbf{x}}=\begin{pmatrix} x_1 & x_2 &1 \end{pmatrix} \begin{pmatrix}a_{11} & a_{12} & b_1 \\ a_{12} & a_{22} & b_2 \\ b_1 & b_2 & c\end{pmatrix}
		 \begin{pmatrix} x_1 \\ x_2 \\ 1 \end{pmatrix}=0$
	\end{center}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Conic sections}
\begin{ceudef}[Conic sections]
	A \textbf{conic section} or \textbf{conics} is the locus (\textit{lugar geométrico}) of all points satisfying
	\begin{center}
		$\tilde{\mathbf{x}}^TM\tilde{\mathbf{x}}=0$
	\end{center}
\end{ceudef}
\begin{ceudef}[Conic equality]
	Two conics $\tilde{\mathbf{x}}^TM_1\tilde{\mathbf{x}}=0$ and $\tilde{\mathbf{x}}^TM_2\tilde{\mathbf{x}}=0$ are the \textbf{same} if 
	\begin{center}
		$M_1=kM_2$
	\end{center}
	for some real number $k$.
\end{ceudef}
\begin{ceudef}[Degenerate and ordinary conics]
	A conic section is \textbf{degenerate} if
	\begin{center}
		$\mathrm{det}\{M\}=0$
	\end{center}
	A conic section is \textbf{ordinary}, if it is not degenerate.
\end{ceudef}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Conic sections}
\begin{exampleblock}{Examples of ordinary conics}
	\begin{tabular}{lc}
		Circumphere & $\frac{x^2}{r^2}+\frac{y^2}{r^2}=1$ \\
		Ellipse & $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$ \\
		Hyperbola & $\frac{x^2}{a^2}-\frac{y^2}{b^2}=1$ \\
		Parabola & $y^2=2px$ \\
	\end{tabular}
\end{exampleblock}
\begin{exampleblock}{Examples of degenerate conics}
	\begin{tabular}{ll}
		Two lines & $x^2-y^2=(x-y)(x+y)=0$ \\
		Two lines & $x^2-4=(x-2)(x+2)=0$ \\
		Two lines (superposed) & $x^2=0$ \\
		Two complex lines & $x^2+y^2=(x-iy)(x+iy)=0$ \\
	\end{tabular}
\end{exampleblock}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of a conics and a line}
\begin{block}{Intersection of a conics and a line}
  Consider the parametric equation of a line in homogeneous coordinates
	\begin{center}
		$\tilde{\mathbf{l}}(t)=
		  \begin{pmatrix}l_1(t)\\l_2(t)\\1\end{pmatrix}=\begin{pmatrix}p_1+tv_1\\p_2+tv_2\\1\end{pmatrix}=\begin{pmatrix}p_1\\p_2\\1\end{pmatrix}+t\begin{pmatrix}v_1\\v_2\\0\end{pmatrix}
			=\tilde{\mathbf{p}}+t\tilde{\mathbf{v}} $
	\end{center}
	We need to find a point in the line (i.e., $t$) such that
	\begin{center}
		$\tilde{\mathbf{l}}(t)^TM\tilde{\mathbf{l}}(t)=0$\\
		$(\tilde{\mathbf{p}}+t\tilde{\mathbf{v}})^TM(\tilde{\mathbf{p}}+t\tilde{\mathbf{v}})=0$\\
		$\tilde{\mathbf{v}}^TM\tilde{\mathbf{v}}t^2+2\tilde{\mathbf{v}}^TM\tilde{\mathbf{p}}t+\tilde{\mathbf{p}}^TM\tilde{\mathbf{p}}=0$
	\end{center}
	This is a second order equation in $t$. If there is no solution, then the line does not intersect the conics. If there is only 1 solution, then the line is \textbf{tangent} to the conics. If there are
	2 solutions, then the line intersects the conics (the line is \textbf{secant} to the conics, \textit{secante}).
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Reduced equation of a conics}
\begin{block}{Reduced equation of a conics}
  Let $\lambda_1$ and $\lambda_2$ be the eigenvalues of $A=\begin{pmatrix}a_{11} & a_{12} \\ a_{12} & a_{22} \end{pmatrix}$. Then, there exists a basis in which the conics can be
	expressed as
	\begin{center}
		\begin{tabular}{|c|c|l|}
		  \hline
			$\lambda_1\neq 0,\lambda_2\neq 0$ & $\lambda_1x^2+\lambda_2y^2+\frac{\det\{M\}}{\det\{A\}}=0$ &
			   \begin{tabular}{l}Ellipses, hyperbolas, \\pairs of intersecting lines.\end{tabular} \\
		  \hline
			$\begin{array}{c}\lambda_1=0,\lambda_2\neq 0\\ \det\{M\}\neq 0\end{array}$ & $y^2=2\sqrt{-\frac{\det\{M\}}{\lambda_2^3}}x$ & Parabolas \\
		  \hline
			$\begin{array}{c}\lambda_1=0,\lambda_2\neq 0\\ \det\{M\}= 0\end{array}$ & $y^2=k$ & Pairs of parallel lines \\
		  \hline
		\end{tabular}
	\end{center}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{General classification of conics}
\begin{ceudef}[Signature of a quadratic form]
	Consider a quadratic form $Q(\mathbf{x})=\mathbf{x}^TA\mathbf{x}$ and its diagonalization such that
	\begin{center}
		$Q(\mathbf{y})=\lambda_1y_1^2+\lambda_2y_2^2+...+\lambda_ny_n^2$
	\end{center}
	The signature of $Q(\mathbf{x})$ is $(n_0,n_+,n_-)$ where $n_0$ is the number of null $\lambda$ coefficients, $n_+$ the number of positve $\lambda$ coefficients, and $n_-$ the 
	number of negative $\lambda$ coefficients.
\end{ceudef}

\begin{ceuthm}
	The signature of a quadratic form is invariant to changes of basis, i.e., it only depends on $Q$.
\end{ceuthm}

\begin{ceudef}[Signature of a matrix]
	The signature of a symmetric matrix is the signature of its associated quadratic form.
\end{ceudef}

\end{frame}

% ==============================================
\begin{frame}\frametitle{General classification of conics}
\begin{block}{General classification of conics}
	\begin{center}
		\begin{tabular}{|c|c|l|}
		  \hline
			$A$ & $M$ & \textbf{Conics} \\
			\hline
			\multirow{3}{*}{$\det\{A\}>0$} & $\mathrm{Sig}\{M\}=(0,1,2)\text{ or }(0,2,1)$ & (Real) Ellipse \\
			                               & $\mathrm{Sig}\{M\}=(0,3)\text{ or }(0,3,0)$ & Empty set (or imaginary ellipse) \\
			                               & $\mathrm{Det}\{M\}=0$ & \begin{tabular}{l}A point (or the intersection \\ of two imaginary lines)\end{tabular} \\
			\hline
			\multirow{2}{*}{$\det\{A\}<0$} & $\det\{M\}\neq 0$ & Hyperbola \\
			                               & $\det\{M\}=0$ & Two secant (real) lines \\
			\hline
			\multirow{2}{*}{$\det\{A\}=0$} & $\det\{M\}\neq 0$ & Parabola \\
			                               & $\det\{M\}=0$ & Two parallel (real) lines \\
			\hline
		\end{tabular}
	\end{center}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Geometric transformations}
\begin{block}{Geometric transformations}
	\begin{itemize}
		\item \underline{Shift}: Shift the center to $\hat{\mathbf{c}}=(c_1,c_2,0)$\\
		      \begin{center}
						$(\tilde{\mathbf{x}}-\hat{\mathbf{c}})^TM_1(\tilde{\mathbf{x}}-\hat{\mathbf{c}})=0$
					\end{center}
		\item \underline{Rotate}: Rotate the conics with a rotation matrix $R$: \\
		      \begin{center}
		  			$(R\tilde{\mathbf{x}})^TM_1(R\tilde{\mathbf{x}})=0$\\
   					$\tilde{\mathbf{x}}^T(R^TM_1R)\tilde{\mathbf{x}}=0$\\
					\end{center}
					with $R=\begin{pmatrix} \cos(\alpha) & -\sin(\alpha) & 0 \\ \sin(\alpha) & \cos(\alpha) & 0 \\ 0 & 0 & 1\end{pmatrix}$.
	\end{itemize}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Ellipse}
\begin{block}{Ellipse}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=a\cos t\\y=b\sin t\end{array}$ \\
				   & $t\in [0,2\pi)$ \\
				Interfocal distance: & $d(F,F')=2c$ \\ & where \\
				& $a^2+b^2=c^2$
			\end{tabular}
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figEllipse.png}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperbola}
\begin{block}{Hyperbola}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}-\frac{y^2}{b^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=\pm a\cosh t\\y=b\sinh t\end{array}$ \\
				   & $t\in \mathbb{R}$ \\
				Interfocal distance: & $d(F,F')=2c$ \\ & where \\
				& $a^2+b^2=c^2$
			\end{tabular}
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figHyperbola.png}
		\end{column}
	\end{columns}
\end{block}

\begin{block}{(Calculus note)}
	\begin{center}
		$\begin{array}{c|c}
		   \cos x=\frac{e^{ix}+e^{-ix}}{2} & \cosh x=\frac{e^{x}+e^{-x}}{2} \\
		   \sin x=\frac{e^{ix}-e^{-ix}}{2} & \sinh x=\frac{e^{x}-e^{-x}}{2} \\
		   \cos^2x+\sin^2x=1 & \cosh^2x-\sinh^2x=1 \\
		\end{array}$
	\end{center}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Parabola}
\begin{block}{Parabola}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $y^2=2px$ \\
				Parametric equation: & $\begin{array}{l}x=\frac{t^2}{2p}\\y=t\end{array}$ \\
				   & $t\in \mathbb{R}$ \\
			\end{tabular}
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figParabola.png}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\subsection{3D Geometry} 
\Outline

\begin{frame}\frametitle{Cross product}
\begin{exerciseblock}{Reference}
	Farin and Hansford, Chapter 10
\end{exerciseblock}

\begin{block}{Cross product}
	\begin{columns}
		\begin{column}{7cm}
		    The cross product is defined for 3D vectors as 
				\begin{center}
					$\mathbf{u}=\mathbf{v}\times \mathbf{w} =
					   \left|\begin{array}{ccc}
						   \mathbf{e}_1 & \mathbf{e}_2 & \mathbf{e}_3 \\
						   v_1 & v_2 & v_3 \\
						   w_1 & w_2 & w_3 \\
						 \end{array}\right|
					$
				\end{center}
				Properties:\\
				\begin{center}
					\begin{tabular}{l}
						$\mathbf{u}\perp\mathbf{v}$ and $\mathbf{u}\perp\mathbf{w}$\\
						$\|\mathbf{v}\times \mathbf{w}\|^2=\|\mathbf{v}\|\|\mathbf{w}\|-(\mathbf{v}\cdot\mathbf{w})^2$\\
						$\mathbf{v}\times (c\mathbf{v})=\mathbf{0}$\\
						$\mathbf{v}\times (c\mathbf{w})=(c\mathbf{v})\times \mathbf{w}=c(\mathbf{v}\times \mathbf{w})$\\
						$\mathbf{w}\times \mathbf{v}=-\mathbf{v}\times \mathbf{w}$\\
						$\mathbf{u}\times (\mathbf{v}+\mathbf{w})=\mathbf{u}\times \mathbf{v}+\mathbf{u}\times \mathbf{w}$\\
						$\mathbf{u}\times (\mathbf{v}\times\mathbf{w})\neq(\mathbf{u}\times \mathbf{v})\times\mathbf{w}$\\
					\end{tabular}
				\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figCrossp.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Cross product}
\begin{exampleblock}{Example}
		\begin{center}
			$\mathbf{u}=\mathbf{e}_1\times \mathbf{e}_2 =
				 \left|\begin{array}{ccc}
					 \mathbf{e}_1 & \mathbf{e}_2 & \mathbf{e}_3 \\
					1 & 0 & 0\\
					0 & 1 & 0\\
					\end{array}\right|=\mathbf{e}_3$\\
			\vspace{0.5cm}
			$\mathbf{u}=\mathbf{e}_2\times \mathbf{e}_1 =
				 \left|\begin{array}{ccc}
					 \mathbf{e}_1 & \mathbf{e}_2 & \mathbf{e}_3 \\
					0 & 1 & 0\\
					1 & 0 & 0\\
					\end{array}\right|=-\mathbf{e}_3$
		\end{center}
\end{exampleblock}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Cross product}
\begin{block}{Coordinate systems}
	\begin{columns}
		\begin{column}{4cm}
				\begin{itemize}
					\item \underline{Right-handed}:\\ 
						$\mathbf{x}\times \mathbf{y}=\mathbf{z}$\\
						$\mathbf{y}\times \mathbf{z}=\mathbf{x}$\\
						$\mathbf{z}\times \mathbf{x}=\mathbf{y}$\\
					\item \underline{Left-handed}:\\ 
						$\mathbf{x}\times \mathbf{y}=-\mathbf{z}$\\
						$\mathbf{y}\times \mathbf{z}=\mathbf{x}$\\
						$\mathbf{z}\times \mathbf{x}=-\mathbf{y}$\\
				\end{itemize}
		\end{column}
		\begin{column}{8cm}
			\begin{center}
				\includegraphics[width=7cm]{figLeftRightHand.png}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Cross product}
\begin{block}{Area of parallelogram}
	\begin{columns}
		\begin{column}{6cm}
		    The norm of $\mathbf{v}\times \mathbf{w}$ is the area of the parallelogram formed by $\mathbf{u}$ and $\mathbf{v}$ and is equal to:
				\begin{center}
					$A=\|\mathbf{v}\times \mathbf{w}\|=\|\mathbf{v}\|\|\mathbf{w}\|\sin(\theta)$\\
				\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figPgram_area.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Lines}
\begin{block}{Parametric equation of a line}
	A line is defined in 3D (and nD) by two points or a point and a vector
	\begin{itemize}
		\item \underline{Given two points}:\\
					$\mathbf{l}(t)=\mathbf{p}+t(\mathbf{q}-\mathbf{p}) \quad t\in\mathbb{R}$
		\item \underline{Given point and vector}:\\
					$\mathbf{l}(t)=\mathbf{p}+t\mathbf{v} \quad t\in\mathbb{R}$
	\end{itemize}
	Giving a point and a perpendicular vector does no longer work.
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Planes}
\begin{block}{Implicit equation of a planes}
	A plane is defined in 3D by a point and a perpendicular vector
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Given a point and the normal direction}:\\
				      $\mathbf{n}\cdot(\mathbf{x}-\mathbf{p})=0$\\
							\vspace{0.5cm}
							In 3D:\\
							\vspace{0.5cm}
							\begin{center}
								$(n_1,n_2,n_3)\cdot(x_1-p_1,x_2-p_2,x_3-p_3)=0 \Rightarrow $\\
								$Ax_1+Bx_2+Cx_3+D=0$\\
							\end{center}
							The absolute value of $D$ in the implicit equation is the distance of the plane to the coordinate system origin.
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[height=5cm]{figPn_plane.eps}
			\end{center}
		\end{column}
	\end{columns}

\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperplanes}
\begin{block}{Hyperplanes}
	A hyperplane of $\mathbb{R}^n$ is an affine space of a dimension $n-1$. For instance
	\begin{center}
		\begin{tabular}{ccc|l}
		  $\mathbb{R}^n$ & Dimension & Dimension of hyperplane & Hyperplane name \\
			\hline
			$\mathbb{R}^2$ & 2D & 1 & Line \\
			$\mathbb{R}^3$ & 3D & 2 & Plane \\
			$\mathbb{R}^n$ & nD & n-1 & Hyperplane \\
		\end{tabular}
	\end{center}
	All hyperplanes are defined by a point ($\mathbf{p}$) and a normal vector ($\mathbf{n}$)
	\begin{center}
    $\mathbf{n}\cdot(\mathbf{x}-\mathbf{p})=0$
	\end{center}
\end{block}

\begin{block}{Distance of a point to a plane (hyperplane)}
	The distance between a point $\mathbf{r}$ and a plane (or hyperplane) is given by
	\begin{center}
		  $d=\frac{\mathbf{n}\cdot(\mathbf{r}-\mathbf{p})}{\|\mathbf{n}\|}$
	\end{center}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Planes}
\begin{block}{Parametric equation of a plane}
	A plane can also be defined in 3D (and nD) by a point and two in-plane vectors
	\begin{columns}
		\begin{column}{7cm}
		  \begin{itemize}
				\item \underline{Given a point and two in-plane vectors}:\\
				      $P(s,t)=\mathbf{p}+s\mathbf{v}+t\mathbf{w} \quad \forall s,t\in\mathbb{R}$\\
				\item \underline{Given three points}:\\
				      $P(s,t)=\mathbf{p}+s(\mathbf{q}-\mathbf{p})+t(\mathbf{r}-\mathbf{p}) \quad \forall s,t\in\mathbb{R}$\\
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=4cm]{figPlane_parametric.eps}
			\end{center}
		\end{column}
	\end{columns}

\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Scalar triple product}
\begin{block}{Scalar triple product}
	\begin{columns}
		\begin{column}{6cm}
		  The volume of a parallelepiped can be measured with the scalar triple product
		  \begin{center}
				$V=\mathbf{u}\cdot(\mathbf{v}\times\mathbf{w})$
			\end{center}
			Properties:
		  \begin{center}
				$\mathbf{u}\cdot(\mathbf{v}\times\mathbf{w})=\mathbf{v}\cdot(\mathbf{u}\times\mathbf{w})=\mathbf{w}\cdot(\mathbf{v}\times\mathbf{u})$
			\end{center}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figPpiped.eps}
			\end{center}
		\end{column}
	\end{columns}

\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Distance between two lines}
\begin{block}{Distance between two lines}
	\begin{columns}
		\begin{column}{7cm}
		  Given two lines in parametric form
		  \begin{center}
				$\mathbf{l}_1(s_c)=\mathbf{p}_0+s_c\mathbf{u}$
				$\mathbf{l}_2(t_c)=\mathbf{q}_0+t_c\mathbf{v}$
			\end{center}
			The distance between the two lines is the length of the vector $\mathbf{w}_c$ that is perpendicular to both lines. $\mathbf{w}_c$ is defined by 
			two points: one in line 1 ($\mathbf{x}_1$) and another one in line 2 ($\mathbf{x}_2$):
		  \begin{center}
				$\mathbf{w}_c=\mathbf{x}_2-\mathbf{x}_1=\mathbf{q}_0+t_c\mathbf{v}-(\mathbf{p}_0+s_c\mathbf{u})$
			\end{center}
			The conditions on $\mathbf{w}_c$ are:
			\begin{center}
				$\mathbf{w}_c \cdot \mathbf{u}=0$ and $\mathbf{w}_c \cdot \mathbf{v}=0$
			\end{center}
			After reorganizing the terms
			\begin{center}
				$\begin{pmatrix}\|\mathbf{u}\|^2 & -\mathbf{u}\cdot\mathbf{v} \\ \mathbf{u}\cdot\mathbf{v} & \|\mathbf{v}\|^2\end{pmatrix}
				 \begin{pmatrix}s_c\\t_c\end{pmatrix}=
				 \begin{pmatrix}(\mathbf{p}_0-\mathbf{q}_0)\cdot\mathbf{u}\\(\mathbf{p}_0-\mathbf{q}_0)\cdot\mathbf{v}\end{pmatrix}$
			\end{center}
		\end{column}
		\begin{column}{4cm}
			\begin{center}
				\includegraphics[width=4cm]{figDistanceTwoLines.png}
			\end{center}
		\end{column}
	\end{columns}

\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of two lines}
\begin{block}{Intersection of two lines}
  The two lines in the previous slide intersect if $\mathbf{x}_1=\mathbf{x}_2$. We also note that the two lines intersect
	if $\mathbf{u}$, $\mathbf{v}$ and $\mathbf{p}_0-\mathbf{q}_0$ are in the same plane, or what is the same they are linearly dependent  
	\begin{center}
		$\left|\begin{pmatrix}\mathbf{u} & \mathbf{v} & \mathbf{p}_0-\mathbf{q}_0\end{pmatrix}\right|=0$
	\end{center}

\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of a line and a plane}
\begin{block}{Intersection of a line and a plane}
	\begin{columns}
		\begin{column}{6cm}
			\begin{itemize}
			  \item \underline{Parametric line, implicit plane}:\\
					\begin{center}
						$\mathbf{l}(t)=\mathbf{p}+t\mathbf{v}$ \\
						$\mathbf{n}\cdot(\mathbf{x}-\mathbf{q})=0$ \\
					\end{center}
					For the intersection we need to find $t$ such that
					\begin{center}
						$\mathbf{n}\cdot(\mathbf{p}+t\mathbf{v}-\mathbf{q})=0$
					\end{center}
					whose solution is
					\begin{center}
						$t=\frac{\mathbf{n}\cdot(\mathbf{q}-\mathbf{p})}{\mathbf{n}\cdot\mathbf{v}}$\\
						$\mathbf{x}=\mathbf{p}+\frac{\mathbf{n}\cdot(\mathbf{q}-\mathbf{p})}{\mathbf{n}\cdot\mathbf{v}}\mathbf{v}$
					\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figLinePlaneIntersect.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of a line and a plane}
\begin{block}{Intersection of a line and a plane}
	\begin{columns}
		\begin{column}{6cm}
			\begin{itemize}
			  \item \underline{Parametric line, parametric plane}:\\
					\begin{center}
						$\mathbf{l}(t)=\mathbf{p}+t\mathbf{v}$ \\
						$\mathbf{P}(t_1,t_2)=\mathbf{q}+t_1\mathbf{u}+t_2\mathbf{w}$ \\
					\end{center}
					We need to find $t$, $t_1$ and $t_2$ such that
					\begin{center}
						$\mathbf{p}+t\mathbf{v}=\mathbf{q}+t_1\mathbf{u}+t_2\mathbf{w}$
					\end{center}
					Reorganizing the terms:
					\begin{center}
						$\begin{pmatrix}\mathbf{u} & \mathbf{w} & -\mathbf{v}\end{pmatrix}\begin{pmatrix}t_1 \\ t_2 \\ t\end{pmatrix}=\mathbf{p}-\mathbf{q}$
					\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{5cm}
			\begin{center}
				\includegraphics[width=5cm]{figLinePlaneIntersect.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of a line and a triangle}
\begin{block}{Intersection of a line and a triangle}
	\begin{columns}
		\begin{column}{7cm}
			\begin{itemize}
			  \item \underline{Parametric line, 3 points of a triangle}:\\
					\begin{center}
						$\mathbf{l}(t)=\mathbf{p}+t\mathbf{v}$ \\
						$\begin{array}{rcl}\mathbf{P}(t_1,t_2)&=&\mathbf{p}_1+t_1(\mathbf{p}_2-\mathbf{p}_1)+t_2(\mathbf{p}_3-\mathbf{p}_1)\\
						 & & t_1,t_2\in[0,1], t_1+t_2\leq 1\end{array}$ \\
					\end{center}
					We need to find $t$, $t_1$ and $t_2$ such that
					\begin{center}
						$\mathbf{p}+t\mathbf{v}=\mathbf{p}_1+t_1(\mathbf{p}_2-\mathbf{p}_1)+t_2(\mathbf{p}_3-\mathbf{p}_1)$
					\end{center}
					Reorganizing the terms:
					\begin{center}
						$\begin{pmatrix}\mathbf{p}_2-\mathbf{p}_1 & \mathbf{p}_3-\mathbf{p}_1 & -\mathbf{v}\end{pmatrix}\begin{pmatrix}t_1 \\ t_2 \\ t\end{pmatrix}=\mathbf{p}-\mathbf{p}_1$
					\end{center}
					The intersection point is within the triangle if $t_1,t_2\in[0,1], t_1+t_2\leq 1$.
			\end{itemize}
		\end{column}
		\begin{column}{4cm}
			\begin{center}
				\includegraphics[width=4cm]{figTriline.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Reflection}
\begin{block}{Reflection}
	\begin{columns}
		\begin{column}{7cm}
			\begin{itemize}
			  \item \underline{Reflection}:\\
				  This situation is encountered, for instance, in reflected light rays.
				  By inspecting the figure we note that 
					\begin{center}
						$\mathbf{n}\cdot\mathbf{v}=-\mathbf{n}\cdot\mathbf{v}'$ \\
					\end{center}
					On the other side, it must also be
					\begin{center}
						$c\mathbf{n}=\mathbf{v}'-\mathbf{v}$
					\end{center}
					We have two unknowns $c$ and $\mathbf{v}$ and two equations. After some manipulation we reach
					\begin{center}
						$\mathbf{v}'=\mathbf{v}-2(\mathbf{n}\cdot\mathbf{n}^T)\mathbf{v}$
					\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{4cm}
			\begin{center}
				\includegraphics[width=4cm]{figReflection.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of three planes}
\begin{block}{Intersection of three planes}
	\begin{columns}
		\begin{column}{7cm}
			\begin{itemize}
			  \item \underline{Implicit equations}:\\
				  For each of the planes, we have
					\begin{center}
						$\mathbf{n}_1\cdot(\mathbf{x}-\mathbf{p}_1)=0 \Rightarrow \mathbf{n}_1^T\mathbf{x}=\mathbf{n}_1^T\mathbf{p}_1$ \\
						$\mathbf{n}_2\cdot(\mathbf{x}-\mathbf{p}_2)=0 \Rightarrow \mathbf{n}_2^T\mathbf{x}=\mathbf{n}_2^T\mathbf{p}_2$ \\
						$\mathbf{n}_3\cdot(\mathbf{x}-\mathbf{p}_3)=0 \Rightarrow \mathbf{n}_3^T\mathbf{x}=\mathbf{n}_3^T\mathbf{p}_3$ \\
					\end{center}
					Gathering all together
					\begin{center}
						$\begin{pmatrix}\mathbf{n}_1^T\\\mathbf{n}_2^T\\\mathbf{n}_3^T\end{pmatrix}\mathbf{x}=\begin{pmatrix}\mathbf{n}_1^T\mathbf{p}_1\\
						   \mathbf{n}_2^T\mathbf{p}_2\\\mathbf{n}_3^T\mathbf{p}_3\end{pmatrix}$
					\end{center}
					In non-degenerate situations, this equation system has a unique solution that is the intersection point. Otherwise, the planes may intersect in one line,
					two lines, three lines, or even in a plane (if the three planes are the same plane).
			\end{itemize}
		\end{column}
		\begin{column}{4cm}
			\begin{center}
				\includegraphics[width=4cm]{fig3planex.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Intersection of two planes}
\begin{block}{Intersection of two planes}
	\begin{columns}
		\begin{column}{7cm}
			\begin{itemize}
			  \item \underline{Implicit equations}:\\
				  For each of the planes, we have
					\begin{center}
						$\mathbf{n}\cdot(\mathbf{x}-\mathbf{p}_1)=0 \Rightarrow \mathbf{n}^T\mathbf{x}=\mathbf{n}^T\mathbf{p}_1$ \\
						$\mathbf{m}\cdot(\mathbf{x}-\mathbf{p}_2)=0 \Rightarrow \mathbf{m}^T\mathbf{x}=\mathbf{m}^T\mathbf{p}_2$ \\
					\end{center}
					The two planes intersect in a line of the form
					\begin{center}
						$\mathbf{l}(t)=\mathbf{p}+t(\mathbf{n}\times\mathbf{m})$
					\end{center}
					To find $\mathbf{p}$ we solve the equation system
					\begin{center}
						$\begin{pmatrix}\mathbf{n}^T\\\mathbf{m}^T\\(\mathbf{n}\times\mathbf{m})^T\end{pmatrix}\mathbf{x}=\begin{pmatrix}\mathbf{n}^T\mathbf{p}_1\\
						   \mathbf{m}^T\mathbf{p}_2\\ 0\end{pmatrix}$
					\end{center}
			\end{itemize}
		\end{column}
		\begin{column}{4cm}
			\begin{center}
				\includegraphics[width=4cm]{fig2planes.eps}
			\end{center}
		\end{column}
	\end{columns}
\end{block}
\end{frame}

% ==============================================
\subsection{Quadrics in 3D} 
\Outline

\begin{frame}\frametitle{Quadrics}
\begin{exerciseblock}{Reference}
	Juan de Buegos (2000), Capítulo 12
\end{exerciseblock}

\begin{block}{Quadrics}
	Quadrics are 3D surfaces that meet a second order equation.
	\begin{center}
		\includegraphics[width=12cm]{figQuadrics.jpg}
	\end{center}
	\href{http://en.wikipedia.org/wiki/Quadric}{Quadrics in the Wikipedia}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Ellipsoid}
\begin{block}{Ellipsoid}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=a\cos u\sin v\\y=b\sin u \sin v \\ z=c\cos v\end{array}$ \\
				   & $u,v\in [0,2\pi)$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$, $Y$ and $Z$ are ellipses.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figEllipsoid.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperboloid of one sheet}
\begin{block}{Hyperboloid of one sheet}
	\begin{columns}
		\begin{column}{8cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}-\frac{z^2}{c^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=a\sqrt{1+u^2}\cos v\\y=b\sqrt{1+u^2}\sin v \\ z=cu\end{array}$ \\
				Parametric equation: & $\begin{array}{l}x=a\cosh u\cos v\\y=b\cosh u \sin v \\ z=c\sinh u\end{array}$ \\
				   & $v\in [0,2\pi)$, $u\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are hyperbolas. \\
			Cuts along $Z$ are ellipses.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=3cm]{figHyperboloidOneSheet.jpg}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperboloid of two sheets}
\begin{block}{Hyperboloid of two sheets}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}-\frac{z^2}{c^2}=-1$ \\
				Parametric equation: & $\begin{array}{l}x=a\sinh u\cos v\\y=b\sinh u \sin v \\ z=c\cosh u\end{array}$ \\
				   & $v\in [0,2\pi)$, $u\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are hyperbolas. \\
			Cuts along $Z$ are ellipses.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figHyperboloidTwoSheets.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Elliptic paraboloid}
\begin{block}{Elliptic paraboloid}
	\begin{columns}
		\begin{column}{7cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}-\frac{z}{c}=0$ \\
				Parametric equation: & $\begin{array}{l}x=a\sqrt{u}\cos v\\y=b\sqrt{u} \sin v \\ z=cu\end{array}$ \\
				   & $v\in [0,2\pi)$, $u\in [0,\infty)$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are parabolas. \\
			Cuts along $Z$ are ellipses.
		\end{column}
		\begin{column}{4cm}
			\includegraphics[width=3.5cm]{figEllipticParaboloid.jpg}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperbolic paraboloid}
\begin{block}{Hyperbolic paraboloid}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}-\frac{y^2}{b^2}-\frac{z}{c}=0$ \\
				Parametric equation: & $\begin{array}{l}x=a\sqrt{u}\cosh v\\y=b\sqrt{u} \sinh v \\ z=cu\end{array}$ \\
				   & $u,v\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $Y$ are parabolas. \\
			Cuts along $Z$ are hyperbolas.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figHyperbolicParaboloid.jpg}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Cone}
\begin{block}{Cone}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}-\frac{z^2}{c^2}=0$ \\
				Parametric equation: & $\begin{array}{l}x=au\cos v\\y=bu \sin v \\ z=cu\end{array}$ \\
				   & $v\in[0,2\pi), u\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $Y$ are parabolas. \\
			Cuts along $Z$ are ellipses.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figCone.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Elliptic cylinder}
\begin{block}{Elliptic cylinder}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=a\cos v\\y=b \sin v \\ z=u\end{array}$ \\
				   & $v\in[0,2\pi), u\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are pairs of lines. \\
			Cuts along $Z$ are ellipses.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figEllipticCylinder.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Hyperbolic cylinder}
\begin{block}{Hyperbolic cylinder}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}-\frac{y^2}{b^2}=1$ \\
				Parametric equation: & $\begin{array}{l}x=a\cosh v\\y=b \sinh v \\ z=u\end{array}$ \\
				   & $u,v\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are pairs of lines. \\
			Cuts along $Z$ are hyperbolas.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figHyperbolicCylinder.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Parabolic cylinder}
\begin{block}{Parabolic cylinder}
	\begin{columns}
		\begin{column}{6cm}
		  \begin{tabular}{ll}
				Reduced equation: & $\frac{x^2}{a^2}-\frac{y}{b}=0$ \\
				Parametric equation: & $\begin{array}{l}x=au\\y=bu^2 \\ z=v\end{array}$ \\
				   & $u,v\in \mathbb{R}$ \\
			\end{tabular}
			\\
			\vspace{0.5cm}
			Cuts along $X$ and $Y$ are pairs of lines or single lines. \\
			Cuts along $Z$ are parabolas.
		\end{column}
		\begin{column}{5cm}
			\includegraphics[width=4.5cm]{figParabolicCylinder.png}
		\end{column}
	\end{columns}
\end{block}

\end{frame}

% ==============================================
\begin{frame}\frametitle{Quadrics}
\begin{ceudef}{Quadrics}
	All quadrics can be written as
	\begin{center}
		$\sum\limits_{i,j=1}^3{a_{ij}x_ix_j}+2\sum\limits_{i=1}^3{b_ix_i}+c=0$ \\
		$\tilde{\mathbf{x}}^TM\tilde{\mathbf{x}}=0$
	\end{center}
	with $a_{ij}=a_{ji}$ and
	\begin{center}
		$M=\begin{pmatrix}a_{11} & a_{12} & a_{13} & b_1 \\ a_{12} & a_{22} & a_{23} &b_2 \\ a_{13} & a_{23} & a_{33} & b_3 \\ b_1 & b_2 & b_3 & c\end{pmatrix}$ and 
		$\tilde{\mathbf{x}}=\begin{pmatrix}x_1 \\ x_2 \\ x_3 \\1 \end{pmatrix}$
	\end{center}
\end{ceudef}
\end{frame}

% ==============================================
\begin{frame}\frametitle{Quadrics}
\begin{ceudef}[Quadrics equality]
	Two quadrics $\tilde{\mathbf{x}}^TM_1\tilde{\mathbf{x}}=0$ and $\tilde{\mathbf{x}}^TM_2\tilde{\mathbf{x}}=0$ are the \textbf{same} if 
	\begin{center}
		$M_1=kM_2$
	\end{center}
	for some real number $k$.
\end{ceudef}

\begin{ceudef}[Degenerate or ordinary quadrics]
	A quadrics is \textbf{degenerate} if $\det\{M\}=0$ (e.g., cones, cylinders and pairs of planes). It is ordinary if it is not degenerate (e.g., ellipsoids, paraboloids, hyperboloids)
\end{ceudef}

\begin{exampleblock}{Examples of degenerate quadrics}
	\begin{tabular}{ll}
		$x^2-y^2=0=(x-y)(x+y)$ & A pair of planes \\
		$x^2+y^2=0=(x-iy)(x+iy)$ & A pair of imaginary planes \\
		$x^2-1=0=(x-1)(x+1)$ & A pair of planes \\
		$x^2+y^2-25=0$ & Cylinder of radius 5 \\
	\end{tabular}
\end{exampleblock}

\end{frame}

% ==============================================
\begin{frame}\frametitle{General classification of quadrics}
\begin{block}{General classification of quadrics}
  Let $\lambda_1$, $\lambda_2$ and $\lambda_3$ be the eigenvalues of $A$. Then, there exists a basis such that the reduced equation of the quadrics is
	\begin{center}
		\begin{tabular}{|c|l|}
		  \hline
			\textbf{Condition} & \textbf{Quadrics} \\
			\hline
			$\lambda_1\neq 0, \lambda_2\neq 0, \lambda_3\neq 0$ & $\lambda_1x^2+\lambda_2y^2+\lambda_3z^2+\frac{\det\{M\}}{\det\{A\}}=0$ \\
			   & Ellipsoids, hyperboloids and cones \\
			\hline
			$\begin{array}{c}\lambda_1\neq 0, \lambda_2\neq 0, \lambda_3=0\\ \det\{M\}\neq0\end{array}$ &
			   $\lambda_1x^2+\lambda_2y^2=2\sqrt{-\frac{\det\{M\}}{\lambda_1\lambda_2}}z$ \\
			   & Paraboloid \\
			\hline
			$\begin{array}{c}\lambda_1\neq 0, \lambda_2\neq 0, \lambda_3=0\\ \det\{M\}=0\end{array}$ &
			   $\lambda_1x^2+\lambda_2y^2=k$ \\
			   & Elliptical cylinder \\
			\hline
			$\begin{array}{c}\lambda_1= 0, \lambda_2\neq 0, \lambda_3=0\\ \mathrm{Rank}\{M\}=3\end{array}$ &
			   $y^2=2qx$ 
			   Parabolic cylinder \\
			\hline
			$\begin{array}{c}\lambda_1= 0, \lambda_2\neq 0, \lambda_3=0\\ \mathrm{Rank}\{M\}<3\end{array}$ &
			   $y^2=k$ 
			   Pair of planes \\
			\hline
		\end{tabular}
	\end{center}
\end{block}
\end{frame}

\OutlineFinal

\end{document}